/*
	The Raja Toolkit.
	Copyright (C) 2011 Raja-Toolkit Foundation

	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public
	License as published by the Free Software Foundation; either
	version 3.0 of the License, or (at your option) any later version.

	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
*/

#ifndef FRAMEBUFFER_HPP
#define FRAMEBUFFER_HPP

#include "../types.hpp"
#include "../math/math.hpp"

#include "sampler2.hpp"

namespace raja
{
namespace render
{
struct framebuffer
{
	static framebuffer*		create(sampler2 *color, sampler2 *depth);

	void				push();
	void				pop();

	void				attach_color(sampler2 *color);
	void				attach_depth(sampler2 *depth);

	sampler2*			get_color_attachment() const { return __color; }
	sampler2*			get_depth_attachment() const { return __depth; }

private:
	framebuffer() : __fbo(0), __color(0), __depth(0)
	{
	}

	uint32				__old_fbo;
	uint32				__fbo;
	sampler2*			__color;
	sampler2*			__depth;
};

} // namespace render
} // namespace raja

#endif // FRAMEBUFFER_HPP
